package com.molin.innerClass.lambdalianxi3;

import java.util.Random;

public class RandomNumberHandlerTest {
    public static void main(String[] args) {
        Random random=new Random();

        printNum(new RandomNumHandler() {
            @Override
            public int getNumber() {
                return random.nextInt(10)+1;
            }
        });

        printNum(()->{return random.nextInt(10)+1;});
    }
    public static void printNum(RandomNumHandler randomNumHandler){
        int randomNumber=randomNumHandler.getNumber();
        System.out.println(randomNumber);
    }
}
